package com.charity.mapper;

import com.charity.pojo.Advertisement;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AdvertisementMapper {

    @Select("select * from advertisement")
    List<Advertisement> advertisements();

    @Select("select * from advertisement where no=#{no}")
    Advertisement advertisement(Integer no);

    @Update("update advertisement set title=#{title}, content=#{content} where no=#{no}")
    Integer updateAdvertisement(Integer no, String title, String content);

    @Insert("insert into advertisement(title, content, createDate) values(#{title}, #{content}, #{createDate})")
    Integer addAdvertisement(String title, String content, String createDate);

    @Delete("delete from advertisement where no=#{no}")
    Integer deleteAdvertisement(Integer no);

}
